#ifndef _ALGA_AMD_ATOMBIOS_DCE_H
#define _ALGA_AMD_ATOMBIOS_DCE_H
/*
  author Sylvain Bertrand <digital.ragnarok@gmail.com>
  Protected by GNU Affero GPL v3 with some exceptions.
  See README at root of alga tree.
*/
void atb_lock(struct atombios *atb, bool lock);
int atb_trans_link_init(struct atombios *atb, unsigned i, bool edp);
int atb_trans_link_off(struct atombios *atb, unsigned i);
int atb_trans_link_on(struct atombios *atb, unsigned i, unsigned dp_lanes_n,
							unsigned pixel_clk);
int atb_trans_link_output_off(struct atombios *atb, unsigned i);
int atb_trans_link_output_on(struct atombios *atb, unsigned i, unsigned dp_lanes_n,
							unsigned pixel_clk);
int atb_trans_link_pwr(struct atombios *atb, unsigned i, bool on);
int atb_trans_link_vs_pre_emph(struct atombios *atb, unsigned i, u8 vs_pre_emph);

int atb_enc_crtc_src(struct atombios *atb, unsigned i);
int atb_enc_video(struct atombios *atb, unsigned i, bool on);
int atb_enc_setup(struct atombios *atb, unsigned i, unsigned dp_lanes_n,
		unsigned dp_link_rate, unsigned bpc, unsigned pixel_clk);
int atb_crtc_blank(struct atombios *atb, unsigned i, bool on);
int atb_crtc_mem_req(struct atombios *atb, unsigned i, bool on);
int atb_crtc(struct atombios *atb, unsigned i, bool on);
int atb_crtc_lock(struct atombios *atb, unsigned i, bool lock);
int atb_crtc_virtual_pixel_clk(struct atombios *atb, unsigned i, unsigned  clk);
int atb_crtc_timing(struct atombios *atb, unsigned i, struct alga_timing *t);
int atb_crtc_dcpll(struct atombios *atb);
int atb_crtc_overscan(struct atombios *atb, unsigned i);
int atb_crtc_scaler(struct atombios *atb, unsigned i);

int atb_enc_dp_training_start(struct atombios *atb, unsigned i);
int atb_enc_dp_training_complete(struct atombios *atb, unsigned i);
int atb_enc_dp_tp(struct atombios *atb, unsigned i, unsigned link_rate,
						unsigned lanes_n, unsigned tp);

#include <alga/amd/atombios/dp_paths.h>
int atb_dp_paths(struct atombios *atb, struct atb_dp_path **dp_paths,
							size_t *dp_paths_n);
void atb_dp_state(struct atombios *atb, unsigned dfp, bool connected);

int atb_dp_aux_native_read(struct atombios *atb, u8 aux_i2c_id, u8 hpd,
				u32 addr, u8 *recv_buf, size_t recv_buf_sz);
int atb_dp_aux_native_write(struct atombios *atb, u8 aux_i2c_id, u8 hpd,
				u32 addr, u8 *send_buf, size_t send_buf_sz);

#define ATB_MODE_I2C_READ	1
#define ATB_MODE_I2C_WRITE	2
#define ATB_MODE_I2C_START	4
#define ATB_MODE_I2C_STOP	8
int atb_dp_aux_i2c(struct atombios *atb, u8 aux_i2c_id, u8 hpd, u16 addr,
				unsigned mode, u8 byte_send, u8 *byte_recv);
#endif
